<template>
	<view>
		<TabBar currentPath="/pages/user/user"></TabBar>
		<view>
			<text>user11</text>
			<text>{{userName}}</text>
			<view>
				<text>{{token}}</text>
			</view>
			<button @click="changeName">changeNamne</button>
			<button @click="changeToken">changeToken</button>

		</view>
	</view>
</template>

<script>
	import {
		getList
	} from '../../api/user.js'
	import {
		mapState,
		mapMutations
	} from 'vuex'
	export default {
		data() {
			return {

			}
		},
		computed: {
			...mapState('user', ['userName', 'token']),
		},
		mounted() {
			this.getListFn()
		},
		methods: {
			...mapMutations('user', ['setToken','setUserName']),
			changeName() {
				this.setUserName("张三")
			},
			changeToken() {
				uni.setStorageSync("token", "333")
				this.setToken(444)
			},
			async getListFn() {
				const res = await getList({
					type: 0
				})
				console.log(res.data);
			}
		}
	}
</script>

<style>

</style>